<?php

namespace Modules\Admin\Entities;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Spatie\Permission\Models\Role as SpatieRole;

class Role extends SpatieRole
{
    use HasFactory;
    // 记录操作日志

    public static function getTableName()
    {
        return with(new static)->getTable();
    }

    protected static function newFactory()
    {
        return \Modules\Permission\Database\factories\RoleFactory::new();
    }

    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }
}
